<template>
  <div class="song-list">
    <ul>
      <li @click="selectItem(song, index)" v-for="(song, index) in songs" class="item" :key="index">
       <!--  <div class="rank" v-show="rank">
          <span :class="getRankCls(index)">{{ getRankText(index) }}</span>
        </div> -->
        <div class="content">
          <h2 class="name">{{ song.name }}</h2>
          <p class="desc">{{ getDesc(song) }}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    songs: {
      type: Array
    }
    // rank: {
    //   type: Boolean,
    //   default: false
    // }
  },
  computed: {
  },
  methods: {
    selectItem (item, index) {
      this.$emit('select', item, index)
    },
    getDesc (song) {
      if (song.aliaName) {
        return `${song.singer} - ${song.aliaName}`
      } else {
        return `${song.singer}`
      }
    }
  //   getRankCls () {
  //     if (index <= 2) {
  //       return ``
  //     }
  //   },
  //   getRankText () {}
  },
  created () {
    // console.log(this.songs)
  }
}
</script>

<style lang="less" scoped>
@import "~@/common/stylus/variable";
@import "~@/common/stylus/mixin";
ul {
  padding: 0;
  margin: 0;
}
.song-list {
  .item {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    height: 60px;
    border-bottom: 1px solid rgb(228, 228, 228);
    .count {
      flex: 0 0 50px;
      width: 50px;
      text-align: center;
      color: @color-text-g;
    }
  }
}
.content {
  flex: 1;
  line-height: 20px;
  overflow: hidden;
}
.desc {
  @include no-wrap();
  width: 80%;
  font-size: 12px;
  color: @color-text-g;
}
.name {
  margin-top: 4px;
  width: 80%;
  @include no-wrap();
  color: @color-text;
  font-size: 15px;
}
</style>
